package org.guiceside.commons.collection;

import java.math.BigDecimal;
import java.util.Map;

import org.apache.log4j.Logger;

/**
 * <p>
 * request参数存储类
 * </p>
 * @author zhenjia  <a href='mailto:zhenjiaWang@gmail.com'>email</a>
 * @since JDK1.5
 * @version 1.0 $Date:200808
 */
public class RequestData<K,V> extends AbstractData {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private static final Logger log = Logger.getLogger(RequestData.class);

	public RequestData() {

	}

	public RequestData(String name) {
		this.name = name;
	}

	public RequestData(int arg) {
		super(arg);
	}

	public RequestData(int arg, float arg1) {
		super(arg, arg1);
	}

	public RequestData(int arg, float arg1, boolean arg2) {
		super(arg, arg1, arg2);
	}

	public RequestData(Map<String, Object> arg) {
		super(arg);
	}

	
	public void set(String key, Object value) {
		super.put(key, value);
	}

	
	public void setString(String key, Object value) {
		super.put(key, value);
	}

	
	public void setInt(String key, int value) {
		Integer integer = new Integer(value);
		super.put(key, integer);
	}

	
	public void setFloat(String key, float value) {
		Float f = new Float(value);
		super.put(key, f);
	}

	
	public void setDouble(String key, double value) {
		Double dou = new Double(value);
		super.put(key, dou);
	}

	
	public void setLong(String key, long value) {
		Long lon = new Long(value);
		super.put(key, lon);
	}

	
	public void setShort(String key, short value) {
		Short shor = new Short(value);
		super.put(key, shor);
	}

	
	public void setBoolean(String key, boolean value) {
		Boolean bool = new Boolean(value);
		super.put(key, bool);
	}

	
	public void setBigDecimal(String key, BigDecimal value) {
		super.put(key, value);
	}

	public Object get(Object key) {
		Object o = super.get(key);
		return o;
	}



	

	public String getString(Object key) {
		Object o = get(key);
		if (o == null) {
			return null;
		}
		return ((String) o).toString();
	}

	public String getStringTrim(Object key) {
		Object o = get(key);
		if (o == null) {
			return null;
		}
        return ((String) o).toString().trim();
	}
}
